<script>
    $(function() {
      $(".video-js").each(function (_index,el) {
                          $(this).hide();
                          var _mp3Atrr = $(this).find("source");
                          var _mp3, _type;
                          for (var i= 0; i< _mp3Atrr.length;i++){
                          var $thAttr = $(_mp3Atrr[i]);
                          var _tp = $thAttr.attr('type');
                          if (_tp =='audio/mp3') {
                          _type = _tp;
                          console.log(_type);
                          _mp3 = $thAttr.attr('src');
                          }
                          }
                          var _htmlPause = $('<div class="play-btn" style="margin-top: -1px;margin-left: -1px;display:none;background:rgba(122,184,233,1);width: 32px;height: 32px;border-radius: 50%;cursor: pointer;position: relative;"><div class="play-btn-con" style="position: absolute;left: 50%;top: 50%;width: 5px;height: 14px; background:none; border-left: 4px solid #fff;border-right: 4px solid #fff;margin-top: -7px;margin-left: -7px;"></div></div>');
                          _htmlPause.attr('onClick','playMedia(\"'+ _mp3.toString() + '\",0,'+ _index +')');
                          var _htmlPlay ='';
                          
                          if (_type =='audio/mp3') {
                          _htmlPlay = $('<div onClick=playMedia("' + _mp3 + '",1,' + _index + ') class="play_1" style="margin-top: -1px;margin-left: -1px;background:rgba(122,184,233,1);width: 32px;height: 32px;border-radius: 50%;cursor: pointer;position: relative;"><div class="play-btn-con" style="position: absolute;left: 50%;top: 50%;width: 0;height: 0;border-top: 8px solid transparent;border-left: 14px solid #fff;border-bottom: 8px solid transparent;margin-top: -8px;margin-left: -5px;"></div></div>');
                          }
                          _htmlPlay.attr('onClick','playMedia(\"'+ _mp3.toString() + '\",1,'+ _index +')');
                          
                          $(this).parent().empty().append(_htmlPlay).append(_htmlPause);
                          
                          });
      });
      
      function playMedia (media,num,_indx) {
          play(num,_indx)
      }

function play(num,_indx, _color) {
    $('.play_1').css('backgroundColor','rgba(122,184,233,1)');
    $('.play-btn').css('backgroundColor','rgba(122,184,233,1)');
    
    if (num == 0) {
        
        if (_color == 1) {
            $('.play-btn').eq(_indx).css('backgroundColor','#428bca');
        }else {
            $('.play-btn').eq(_indx).css('backgroundColor','rgba(122,184,233,1)');
        }
        $('.play_1').show();
        $('.play_1').eq(_indx).hide();
        $('.play-btn').hide();
        $('.play_1').eq(_indx).next().show();
    }else {
        if (_color == 1) {
            $('.play_1').eq(_indx).css('backgroundColor','#428bca');
        }else {
            $('.play_1').eq(_indx).css('backgroundColor','rgba(122,184,233,1)');
        }
        $('.play-btn').eq(_indx).hide();
        $('.play-btn').eq(_indx).prev().show();
    }
    return false;
}
</script>
